﻿<?php
session_start();
require_once(dirname(__FILE__)."/../libs/dbclass/dbconnect.php");
require_once(dirname(__FILE__)."/../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../libs/shijuan/sj_class.php");
require_once(dirname(__FILE__)."/../libs/public/public_func.php");
$sj=new shijuan();
$mc= new libstr();
$dl=new deal_class();

$xueduanID=$_GET["xueduanID"];
$xk=$_GET["xk"];
$xd=$_GET["xd"];
$xuekesql="";
$xueduansql="";
if($mc->Ismp($xk)!=""){
	$xuekesql=" and xuekeID=".$xk;
}
if($mc->Ismp($xd)!=""){
	$xueduansql=" and xueduanID=".$xd;
}

$cataid=0;
if($_GET["id"]!=""){
$cataid=$_GET["id"];
}
$sql="select ID,classname,xuekeID,nianjiID,xueqiID,rootid,(select count(b.ID) as tt from zhishidian_class as b where b.pid=t.ID) as tj from zhishidian_class as t where t.pid=".$cataid.$xuekesql.$xueduansql."";
 $getrs=$db->ds($sql);
//print_r($getrs);
header("Content-Type:text/xml;");
echo '<?xml version="1.0" encoding="utf-8"'.'?'.'>';
echo '<tree id="'.$cataid.'">';
 if(count($getrs)>0){
for($i=0;$i<count($getrs);$i++){
//  echo '<item text="'.$getrs[$i][classname].'" id="'.$getrs[$i][ID].'"  child="'.$getrs[$i]["tj"].'" >';
echo '<item text="'.$getrs[$i][classname].'" id="'.$getrs[$i][ID].'"  child="'.$getrs[$i]["tj"].'" />';
}
 }

//echo '</item>';

echo '</tree>';
?>

